﻿using System;
using Newtonsoft.Json;


namespace vDisk.WindowsPhone
{
    public class UserLogin
    {
        public string Token { get; set; }

        public string DoLogid { get; set; }
    }

    /// <summary>
    /// 服务器返回类基类
    /// </summary>
    public class ResponseBase
    {
        public string err_code { get; set; }
        public string err_msg { get; set; }        
    }

    /// <summary>
    /// 返回带有id的基类
    /// </summary>
    public class CommonResponseBase : ResponseBase
    {
        public string dologid { get; set; }
        public string [] dologdir { get; set; }
    }

    public class TokenResponse : ResponseBase
    {
        public string dologdir { get; set; }
        public TokenData data { get; set; }
    }

    public class CommonResponse:CommonResponseBase
    {
        public TokenData data { get; set; }
    }

    #region 获取Token
    public class TokenData
    {
        public string token { get; set; }
        public string uid { get; set; }
        public string time { get; set; }
        public string is_active { get; set; }
        public string appkey { get; set; }
    }
    #endregion

    #region 上传文件

    public class UploadResponse : ResponseBase
    {
        public UploadResponseData data { get; set; }
        public string dologid { get; set; }
    }

    public class UploadResponseData
    {
        public string fid { get; set; }
        public string name { get; set; }
        public string uid { get; set; }
        public string dir_id { get; set; }
        public string do_dir { get; set; }
        public string ctime { get; set; }
        public string ltime { get; set; }
        public string size { get; set; }
        public string type { get; set; }
        public string md5 { get; set; }
        public string sha1 { get; set; }

    }
    #endregion    

    #region 容量信息
    /// <summary>
    /// 容量信息Data
    /// </summary>
    public class QuotaData
    {
        public string used { get; set; }
        public string total { get; set; }
    }

    public class QuotaResponse : CommonResponseBase
    {
        public QuotaData data { get; set; }
    }
    #endregion

    #region 文件复制、移动
    public class FileResponse:CommonResponseBase
    {
        public FileData data { get; set; }
    }
    public class FileData
    {
        public string fid { get; set; }

        public string name { get; set; }

        public string uid { get; set; }

        public string dir_id { get; set; }

        public string do_dir { get; set; }

        public string ctime { get; set; }

        public string ltime { get; set; }

        public string size { get; set; }

        public string type { get; set; }

        public string md5 { get; set; }

        public string sha1 { get; set; }

        public string url { get; set; }
    }
    #endregion

    #region 获取列表
    public class vDiskListIem : CommonResponseBase
    {
        public vDiskItemData data { get; set; }
    }

    public class vDiskItemData
    {
        public vDiskItem[] list { get; set; }

        public PageInfo pageinfo { get; set; }
    }

    public class vDiskItem
    {
        public string id { get; set; }

        public string name { get; set; }

        public string dir_id { get; set; }

        public string ctime { get; set; }

        public string ltime { get; set; }

        public string size { get; set; }

        public string type { get; set; }

        public string md5 { get; set; }

        public string sha1 { get; set; }

        public string hid { get; set; }

        [JsonProperty(PropertyName = "byte")]
        public string Bytes { get; set; }

        public string Length { get; set; }

        public string url { get; set; }

        public string pid { get; set; }

        public string file_num { get; set; }

        public string dir_num { get; set; }

        public PageInfo pageinfo { get; set; }
    }
    #endregion
    
    #region 单个文件信息
    public class vDiskFileResponse : CommonResponseBase
    {
        public vDiskFile data { get; set; }
    }

    /// <summary>
    /// 单个文件
    /// </summary>
    public class vDiskFile
    {
        public string id { get; set; }

        public string name { get; set; }

        public string dir_id { get; set; }

        public string ctime { get; set; }

        public string ltime { get; set; }

        public string size { get; set; }

        public string type { get; set; }

        public string md5 { get; set; }

        public string url { get; set; }

        public string s3_url { get; set; }
    }
    #endregion

    #region 页面信息
    public class PageInfo
    {
        /// <summary>
        /// 当前页数
        /// </summary>
        public string page { get; set; }

        /// <summary>
        /// 总的页数
        /// </summary>
        public string pageSize { get; set; }

        public string rstotal { get; set; }

        public string pageTotal { get; set; }
    }
    #endregion

    #region 目录
    public class DirResponse:CommonResponseBase
    {
        public DirData data { get; set; }
    }

    public class DirData
    {
        public string id { get; set; }

        public string name { get; set; }

        public string dir_id { get; set; }

        public string parent_id { get; set;}

        public string pid { get; set; }

        public string uid { get; set; }

        public string ctime { get; set; }

        public string ltime { get; set; }
    }
    #endregion

    #region 传入的参数

    /// <summary>
    /// 上传文件请求命令
    /// </summary>
    public class UploadFileReq
    {
        /// <summary>
        /// 文件名
        /// </summary>
        public string FileName { get; set; }

        /// <summary>
        /// 文件所在的原路径
        /// </summary>
        public string SourceFolder { get; set; }

        /// <summary>
        /// 重名时是否覆盖, yes或no
        /// </summary>
        public string IsCover { get; set; }

        /// <summary>
        /// 目录的id, 0为根目录
        /// </summary>
        public string DirId { get; set; }

    }

    #endregion
}
